/*
* ECARX Technology Limited is the owner of the copyright and the trade secret of this software.
* Without permission, no one has the right to obtain, disclose or use this software in any way.
*/

package ecarx.xsf.notificationcenter.base.push.model.payload;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

import java.util.List;

public class PushMsgEvent implements Parcelable {

    private long id;            // 0
    private String functionId;  // 事件功能id
    private String targetApp;   // "XSFNotificationCenter"
    @SerializedName("package")
    private String pkg;         // "com.ecarx.membercenter"
    private String action;      // "android.intent.action.VIEW"
    private String text;
    private String className;   // "ecarx.photo.HomeActivity"
    private String bgUrl;
    private String uri;         // "URI"
    private List<PushMsgParams> params;

    public PushMsgEvent() {

    }

    public PushMsgEvent(long id, String pkg, String action, String className, String uri, List<PushMsgParams> params) {
        this(id, "","", pkg, action,"", className, "",uri, params);
    }


    public PushMsgEvent(long id, String functionId, String targetApp, String pkg, String action, String text, String className, String bgUrl, String uri, List<PushMsgParams> params) {
        this.id = id;
        this.functionId = functionId;
        this.targetApp = targetApp;
        this.pkg = pkg;
        this.action = action;
        this.text = text;
        this.className = className;
        this.bgUrl = bgUrl;
        this.uri = uri;
        this.params = params;
    }

    protected PushMsgEvent(Parcel in) {
        id = in.readLong();
        functionId = in.readString();
        targetApp = in.readString();
        pkg = in.readString();
        action = in.readString();
        text = in.readString();
        className = in.readString();
        bgUrl = in.readString();
        uri = in.readString();
        params = in.createTypedArrayList(PushMsgParams.CREATOR);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(id);
        dest.writeString(functionId);
        dest.writeString(targetApp);
        dest.writeString(pkg);
        dest.writeString(action);
        dest.writeString(text);
        dest.writeString(className);
        dest.writeString(bgUrl);
        dest.writeString(uri);
        dest.writeTypedList(params);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<PushMsgEvent> CREATOR = new Creator<PushMsgEvent>() {
        @Override
        public PushMsgEvent createFromParcel(Parcel in) {
            return new PushMsgEvent(in);
        }

        @Override
        public PushMsgEvent[] newArray(int size) {
            return new PushMsgEvent[size];
        }
    };

    public String getFunctionId() {
        return functionId;
    }

    public void setFunctionId(String functionId) {
        this.functionId = functionId;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getTargetApp() {
        return targetApp;
    }

    public void setTargetApp(String targetApp) {
        this.targetApp = targetApp;
    }

    public String getPkg() {
        return pkg;
    }

    public void setPkg(String pkg) {
        this.pkg = pkg;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getUri() {
        return uri;
    }

    public void setBgUrl(String bgUrl) {
        this.bgUrl = bgUrl;
    }

    public String getBgUrl() {
        return bgUrl;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public List<PushMsgParams> getParams() {
        return params;
    }

    public void setParams(List<PushMsgParams> params) {
        this.params = params;
    }


    @Override
    public String toString() {
        return "PushMsgEvent{" +
                "id=" + id +
                "targetApp='" + targetApp + '\'' +
                ", pkg='" + pkg + '\'' +
                ", action='" + action + '\'' +
                ", className='" + className + '\'' +
                ", uri='" + uri + '\'' +
                ", params=" + params +
                '}';
    }
}
